CREATE TABLE [dbo].[tb_DetallePuntajes]
(
[id] [int] NOT NULL IDENTITY(1, 1),
[Inscripcion] [int] NOT NULL,
[Agente] [int] NOT NULL,
[idConcepto] [int] NOT NULL,
[detalle1] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[detalle2] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[detalle3] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[detalle4] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[detalle5] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[detalle6] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[detalle7] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[detalle8] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE UNIQUE CLUSTERED INDEX [idx_detallePuntajes] ON [dbo].[tb_DetallePuntajes] ([id]) WITH (FILLFACTOR=90) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_DetallePuntajeInscripcion] ON [dbo].[tb_DetallePuntajes] ([id], [Inscripcion]) WITH (FILLFACTOR=90) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IDXDETPUNTINSC] ON [dbo].[tb_DetallePuntajes] ([Inscripcion]) WITH (FILLFACTOR=90) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_DetallePuntajes] WITH NOCHECK ADD CONSTRAINT [FK_tb_DetallePuntajes_tb_Agentes] FOREIGN KEY ([Agente]) REFERENCES [dbo].[tb_Agentes] ([idAgente])
GO
ALTER TABLE [dbo].[tb_DetallePuntajes] WITH NOCHECK ADD CONSTRAINT [FK_tb_DetallePuntajes_tb_ConceptosDePuntaje] FOREIGN KEY ([idConcepto]) REFERENCES [dbo].[tb_ConceptosDePuntaje] ([idConcepto])
GO
ALTER TABLE [dbo].[tb_DetallePuntajes] WITH NOCHECK ADD CONSTRAINT [FK_tb_DetallePuntajes_tb_InscripcionesConvocatorias] FOREIGN KEY ([Inscripcion]) REFERENCES [dbo].[tb_InscripcionesConvocatorias] ([idInscripcionConvocatoria]) ON DELETE CASCADE ON UPDATE CASCADE
GO
GRANT SELECT ON  [dbo].[tb_DetallePuntajes] TO [Juntas]
GRANT INSERT ON  [dbo].[tb_DetallePuntajes] TO [Juntas]
GRANT DELETE ON  [dbo].[tb_DetallePuntajes] TO [Juntas]
GRANT UPDATE ON  [dbo].[tb_DetallePuntajes] TO [Juntas]
GO
